﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using S.Eartag.API.Application.Command.SheepFileConditionCommand;

namespace S.Eartag.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class SheepFileController : ControllerBase
    {
        private readonly IMediator mediator;

        public SheepFileController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 种公种母添加
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> SheepFileConditionCreate(SheepFileConditionCreateCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 档案删除
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpDelete]
        public async Task<int> SheepFileConditionDelete([FromQuery] SheepFileConditionDeleteCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 档案修改
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<int> SheepFileConditionUpdate(SheepFileConditionUpdateCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<int> SheepFileConditionAllDelete([FromQuery]SheepFileConditionAllDeleteCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 根据耳号找到栏位
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<int> SheepFileConditionAuricleUpdate(SheepFileConditionAuricleUpdateCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 修改状态
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<int> SheepFileConditionUpdateprogeny([FromQuery]SheepFileConditionUpdateprogenyCommand request)
        {
            return await mediator.Send(request);
        }
    }
}
